﻿<template>
  <a-card :title="modifyEntity.title">
    <a-spin :spinning="spinning">
      <a-descriptions bordered layout="vertical" size="small" column="2">
        <a-descriptions-item label='项目名称'>
          {{ entity.name }}
        </a-descriptions-item>
        <a-descriptions-item label='智能体ID'>
          {{ entity.botId }}
        </a-descriptions-item>
        <a-descriptions-item label='图片'>
          <img width="50" style="cursor: pointer" height="50" :src="entity.icon" />
        </a-descriptions-item>
        <a-descriptions-item label='项目类别'>
          {{ entity.category }}
        </a-descriptions-item>
        <a-descriptions-item label='项目类型'>
          {{ entity.projectType }}
        </a-descriptions-item>
        <a-descriptions-item label='标记'>
          {{ entity.flag }}
        </a-descriptions-item>
        <a-descriptions-item label='所属用户'>
          {{ entity.source }}
        </a-descriptions-item>
        <a-descriptions-item label='体验价格'>
          {{ entity.experiencePrice }}
        </a-descriptions-item>
        <a-descriptions-item label='月卡价格'>
          {{ entity.monthlyCardPrice }}
        </a-descriptions-item>
        <a-descriptions-item label='单次价格'>
          {{ entity.singlePrice }}
        </a-descriptions-item>
        <a-descriptions-item label='智能体-认证方式'>
          {{ entity.method }}
        </a-descriptions-item>
        <a-descriptions-item label='智能体-Oauth应用-公钥'>
          {{ entity.publickKey }}
        </a-descriptions-item>
        <a-descriptions-item label='智能体-Oauth应用-私钥'>
          {{ entity.privateKey }}
        </a-descriptions-item>
        <a-descriptions-item label='智能体-个人访问令牌-令牌'>
          {{ entity.token }}
        </a-descriptions-item>
        <a-descriptions-item label='工作流-预设指令'>
          {{ entity.instruction }}
        </a-descriptions-item>
        <a-descriptions-item label='工作流-示例内容'>
          {{ entity.example }}
        </a-descriptions-item>
        <a-descriptions-item label='创建时间'>
          {{ entity.createTime }}
        </a-descriptions-item>
        <a-descriptions-item label='创建人'>
          {{ entity.createUser }}
        </a-descriptions-item>
        <a-descriptions-item label='修改时间'>
          {{ entity.updateTime }}
        </a-descriptions-item>
        <a-descriptions-item label='修改人'>
          {{ entity.updateUser }}
        </a-descriptions-item>
        <a-descriptions-item label='描述'>
          {{ entity.description }}
        </a-descriptions-item>
      </a-descriptions>
    </a-spin>
    <!--底部按钮-->
    <footer-tool-bar>
      <a-button icon="reload" @click="handleRefresh" :loading="loading">取消</a-button>
    </footer-tool-bar>
  </a-card>
</template>

<script>
import { getProject } from './project'
import footerToolBar from "@/components/footerToolbar";
export default {
  components: {
    footerToolBar,
  },
  props: {
    modifyEntity: {
      type: Object,
      required: true,
      default: function () {
        return {
          // 传递的主键
          id: '',
          // 页面操作类型
          operation: this.operationFlag.Add,
          // 是否展示编辑页面
          showDetail: false,
          // 标题
          title: ''
        }
      },
    },
  },
  data() {
    return {
      // 遮罩层加载
      spinning: false,
      entity: {},
    }
  },
  mounted() {
    this.loadData()
  },
  methods: {
    //#region 加载数据
    loadData() {
      this.spinning = true;
      let that = this;
      //修改，详情获取详细信息 
      getProject(this.modifyEntity.id).then((res) => {
        this.entity = res.data
        that.spinning = false;
      })
        .catch((error) => {
          that.spinning = false;
        });
    },
    //#endregion

    //#region  取消、关闭
    // 取消、关闭
    handleRefresh() {
      this.spinning = false
      this.$emit('handleRefresh')
    },
    //#endregion
  },
}
</script>
